<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <meta name="copyright" content=
    "Copyright (c) IBM Corporation and others 2000, 2019. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." />
    <meta content="text/html; charset=utf-8" http-equiv="content-type" />
    <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type=
    "text/css" />
    <title>
      Quick Assist
    </title>
    <script language="JavaScript" src=
    "PLUGINS_ROOT/org.eclipse.help/livehelp.js" type="text/javascript">
</script>
    <style type="text/css">
/*<![CDATA[*/
    table.c7 {width: 100%; text-align: left;}
    td.c4 {vertical-align: top;}
    td.c3 {vertical-align: top;}
    th.c2 {vertical-align: top; text-align: center;}
    th.c1 {vertical-align: top;}
    /*]]>*/
    </style>

  </head>
  <body>
    <h1>
      Quick Assist
    </h1>
    <p>
      Quick assists perform local code transformations. They are invoked on a
      selection or a single cursor in the Java editor and use the same shortcut
      as quick fixes (<b>Ctrl+1</b>), but quick assist are usually hidden when
      an error is around. To show them even with errors present on the same
      line, press <b>Ctrl+1</b> a second time.<br />

      <br />
      A selection of quick assists can be assigned to a direct shortcut. By
      default, these are:
    </p>
    <ul>
      <li>Rename in file: <b>Ctrl+2, R</b>
      </li>
      <li>Assign to local: <b>Ctrl+2, L</b>

      </li>
      <li>Assign to field: <b>Ctrl+2, F</b>
      </li>
    </ul>
    <p>
      Assign more shortcuts or change the default shortcuts on the <a class=
      "command-link" href=
      'javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Keys)")'>
      <img src="PLUGINS_ROOT/org.eclipse.help/command_link.svg" alt=
      "Opens keys preference page" /> <b>General &gt; Keys</b></a> preference
      page (in the 'Source' category).<br />

      <br />
      A quick assist light bulb can be turned on on the <a class="command-link"
      href=
      'javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.JavaEditorPreferencePage)")'>
      <img src="PLUGINS_ROOT/org.eclipse.help/command_link.svg" alt=
      "Opens Java editor preference page" /> <b>Java &gt; Editor</b></a>
      preference page.<br />
    </p>
    <table class="c7" border="2" cellpadding="5" summary=
    "List of quick assists">

      <tbody>
        <tr>
          <th class="c1" width="15%">
            Name
          </th>
          <th colspan="3" rowspan="1" class="c2">
            Code example
          </th>
          <th class="c1" width="15%">
            Invocation location
          </th>

        </tr>
        <tr>
          <td class="c3" width="15%">
            Inverse if statement
          </td>
          <td class="c4" width="34%">
            <code>if (x) a(); else b();</code>
          </td>
          <td class="c3">

            &gt;
          </td>
          <td class="c3" width="34%">
            <code>if (!x) b(); else a();</code>
          </td>
          <td class="c3" width="15%">
            On 'if' statements with 'else' block
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Convert to if-!-return
          </td>
          <td class="c4" width="34%">
            <code>if (x == 1) a();</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>if (x != 1) return; <br />
           	a();
            </code>
          </td>
          <td class="c3" width="15%">
            On an 'if' statement
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Inverse boolean expression
          </td>
          <td class="c4" width="34%">
            <code>a &amp;&amp; !b</code>
          </td>
          <td class="c3">

            &gt;
          </td>
          <td class="c3" width="34%">
            <code>!a || b</code>
          </td>
          <td class="c3" width="15%">
            On a boolean expression
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Invert local variable
          </td>
          <td class="c4" width="34%">
            <code>boolean a = false;<br />
            if (a) {}</code>
          </td>

          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>boolean notA = true;<br />
            if (!notA) {}</code>
          </td>
          <td class="c3" width="15%">

            On a boolean variable
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Invert equals
          </td>
          <td class="c4" width="34%">
            <code>a.equals(b)</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>b.equals(a)</code>
          </td>
          <td class="c3" width="15%">

            On a invocation of 'equals'
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Inverse conditional expression
          </td>

          <td class="c4" width="34%">
            <code>x ? b : c</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>!x ? c : b</code>

          </td>
          <td class="c3" width="15%">
            On a conditional expression
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Pull negation up
          </td>
          <td class="c4" width="34%">

            <code>b &amp;&amp; c</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>!(!b || !c)</code>

          </td>
          <td class="c3" width="15%">
            On a boolean expression
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Push negation down
          </td>
          <td class="c4" width="34%">

            !(<code>b &amp;&amp; c)</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            !<code>b || !c</code>

          </td>
          <td class="c3" width="15%">
            On a negated boolean expression
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Remove extra parentheses
          </td>
          <td class="c4" width="34%">

            <code>if ((a == b) &amp;&amp; (c != d)&nbsp; {}</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">

            <code>if (a == b &amp;&amp; c != d)&nbsp; {}</code>
          </td>
          <td class="c3" width="15%">
            On selected expressions
          </td>
        </tr>
        <tr>

          <td class="c3" width="15%">
            Put expression in parentheses
          </td>
          <td class="c4" width="34%">
            <code>return a &gt; 10 ? 1 : 2;</code>
          </td>
          <td class="c3">
            &gt;

          </td>
          <td class="c3" width="34%">
            <code>return (a &gt; 10) ? 1 : 2;</code>
          </td>
          <td class="c3" width="15%">
            On selected expression
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Put expressions in parentheses
          </td>
          <td class="c4" width="34%">
            <code>if (a == b &amp;&amp; c != d)&nbsp; {}</code>
          </td>

          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>if ((a == b) &amp;&amp; (c != d))&nbsp; {}</code>
          </td>

          <td class="c3" width="15%">
            On selected expressions
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Join nested if statements
          </td>
          <td class="c4" width="34%">
            <code>if (a) { if (b) {} }</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>if (a &amp;&amp; b) {}</code>
          </td>

          <td class="c3" width="15%">
            On a nested if statement
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Swap nested if statements
          </td>
          <td class="c4" width="34%">
            <code>if (a) { if (b) {} }</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>if (b) { if (a) {} }</code>
          </td>
          <td class="c3" width="15%">

            On a nested if statement
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Split if statement with and'ed expression
          </td>
          <td class="c4" width="34%">
            <code>if (a &amp;&amp; b) {}</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>if (a) { if (b) {} }</code>
          </td>
          <td class="c3" width="15%">

            On an and'ed expression in a 'if'
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Join selected 'if' statements with ||
          </td>
          <td class="c4" width="34%">
            <code>if (a) x();&nbsp; if (b) x();</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>if (a || b) x();</code>
          </td>
          <td class="c3" width="15%">

            On selected 'if' statements
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Join 'if' sequence in if-else-if
          </td>
          <td class="c4" width="34%">
            <code>if (a) x();&nbsp; if (b) y();</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>if (a) x();&nbsp; else if (b) y();</code>
          </td>

          <td class="c3" width="15%">
            On selected 'if' statements
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Split if statement with or'd expression
          </td>
          <td class="c4" width="34%">
            <code>if (a || b) x();</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>if (a) x();&nbsp; if (b) x();</code>
          </td>

          <td class="c3" width="15%">
            On an or'd expression in a 'if'
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            If-else assignment to conditional expression
          </td>
          <td class="c4" width="34%">
            <code>if (a) x= 1; else x= 2;</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>x= a ? 1 : 2;</code>
          </td>
          <td class="c3" width="15%">

            On an 'if' statement
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            If-else return to conditional expression
          </td>
          <td class="c4" width="34%">
            <code>if (a) return 1;<br />

            else return 2;</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>return a ? 1 : 2;</code>
          </td>

          <td class="c3" width="15%">
            On an 'if' statement
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Conditional expression assignment to If-else
          </td>
          <td class="c4" width="34%">
            <code>x= a ? 1 : 2;</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>if (a) x= 1; else x= 2;</code>
          </td>
          <td class="c3" width="15%">

            On a conditional expression
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Conditional expression return to If-else
          </td>
          <td class="c4" width="34%">
            <code>return&nbsp; a ? 1 : 2;</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>if (a) return 1; else return 2;</code>
          </td>
          <td class="c3" width="15%">

            On a conditional expression
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Switch to If-else
          </td>
          <td class="c4" width="34%">
            <code>switch (kind) {<br />

            case 1: return -1;<br />
            case 2: return -2;<br />
            }</code>
          </td>
          <td class="c3">
            &gt;
          </td>

          <td class="c3" width="34%">
            <code>if (kind == 1) {<br />
            &nbsp;&nbsp;return -1;<br />
            } else if (kind == 2) {<br />
            &nbsp;&nbsp;return -2;<br />
            }</code>

          </td>
          <td class="c3" width="15%">
            On a switch statement
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Convert if-else to switch
          </td>
          
		  <td class="c3" width="34%">
            <code>if (kind == 1) {<br />
            &nbsp;&nbsp;return -1;<br />
            } else if (kind == 2) {<br />
            &nbsp;&nbsp;return -2;<br />
            }</code>

          </td>          
          
          <td class="c3">
            &gt;
          </td>

		  <td class="c4" width="34%">
            <code>switch (kind) {<br />

            case 1: return -1;<br />
            case 2: return -2;<br />
            }</code>
          </td>
          
          <td class="c3" width="15%">
            On an 'if' statement
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Add missing case statements on enums
          </td>
          <td class="c4" width="34%">

            <code>switch (e){<br />
            }</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>switch (e){<br />

            case E1: break;<br />
            case E2: break;<br />
            }</code>
          </td>
          <td class="c3" width="15%">
            On a switch statement
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Exchange operands
          </td>
          <td class="c4" width="34%">
            <code>a + b</code>
          </td>
          <td class="c3">
            &gt;

          </td>
          <td class="c3" width="34%">
            <code>b + a</code>
          </td>
          <td class="c3" width="15%">
            On an infix operation
          </td>
        </tr>
        <tr>

          <td class="c3" width="15%">
            Cast and assign
          </td>
          <td class="c4" width="34%">
            <code>if (obj instanceof Vector) {<br />
            }</code>
          </td>
          <td class="c3">

            &gt;
          </td>
          <td class="c3" width="34%">
            <code>if (obj instanceof Vector) {<br />
            &nbsp;Vector vec= (Vector)obj;</code><br />
            }
          </td>
          <td class="c3" width="15%">

            On an instanceof expression in an 'if' or 'while' statement
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Use separate catch blocks
          </td>
          <td class="c4" width="34%">
            <code>try {<br />

            } catch (FileNotFoundException | InterruptedIOException e) {<br />
            }</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>try {<br />

            } catch (FileNotFoundException e) {<br />
            } catch (InterruptedIOException e) {<br />
            }</code>
          </td>
          <td class="c3" width="15%">
            On a multi-catch block (1.7 or higher)
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Move exceptions to separate catch blocks
          </td>
          <td class="c4" width="34%">
            <code>try {<br />

            } catch (FileNotFoundException | InterruptedIOException | IllegalArgumentException e) {<br />
            }</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>try {<br />

            } catch (FileNotFoundException e) {<br />
            } catch (InterruptedIOException | IllegalArgumentException e) {<br />
            }</code>
          </td>
          <td class="c3" width="15%">
            On exceptions in a multi-catch clause (1.7 or higher)
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Combine catch blocks
          </td>
          <td class="c4" width="34%">
            <code>try {<br />

            } catch (FileNotFoundException e) {<br />
            } catch (InterruptedIOException e) {<br />
            }</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>try {<br />

            } catch (FileNotFoundException | InterruptedIOException e) {<br />
            }</code>
          </td>
          <td class="c3" width="15%">
            On a catch block (1.7 or higher)
          </td>
        </tr>
                
        <tr>
          <td class="c3" width="15%">
            Add finally block
          </td>
          <td class="c4" width="34%">
            <code>try {<br />

            } catch (Exception e) {<br />
            }</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>try {<br />

            } catch (Exception e) {<br />
            } finally {}</code>
          </td>
          <td class="c3" width="15%">
            On a try/catch statement
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Add else block
          </td>
          <td class="c4" width="34%">
            <code>if (a) b();</code>
          </td>
          <td class="c3">
            &gt;
          </td>

          <td class="c3" width="34%">
            <code>if (a) b(); else { }</code>
          </td>
          <td class="c3" width="15%">
            On a if statement
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">

            Replace statement with block
          </td>
          <td class="c4" width="34%">
            <code>if (a) b();</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">

            <code>if (a) { b(); }</code>
          </td>
          <td class="c3" width="15%">
            On a if statement
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Unwrap blocks
          </td>

          <td class="c4" width="34%">
            <code>{ a() }</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>a()</code>

          </td>
          <td class="c3" width="15%">
            On blocks, if/while/for statements
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Combine to single String
          </td>
          <td class="c4" width="34%">
            <code>String phrase= "one" + " two " + "three";</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>String phrase= "one two three";</code>
          </td>

          <td class="c3" width="15%">
            On a string concatenation expression
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Pick out string
          </td>
          <td class="c4" width="34%">

            <code>"abcdefgh"</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>"abc" + "de" + "fgh"</code>
          </td>

          <td class="c3" width="15%">
            select a part of a string literal
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Convert string concatenation to StringBuilder (J2SE 5.0) or
            StringBuffer
          </td>
          <td class="c4" width="34%">
            <code>"Hello " + name</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>StringBuilder builder= new StringBuilder();<br />
            builder.append("Hello ");<br />
            builder.append(name);</code>

          </td>
          <td class="c3" width="15%">
            select a string literal
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Convert string concatenation to MessageFormat
          </td>
          <td class="c4" width="34%">

            <code>"Hello " + name</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>MessageFormat.format("Hello {0}", name);</code>
          </td>

          <td class="c3" width="15%">
            select a string literal
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Split variable
          </td>
          <td class="c4" width="34%">
            <code>int i= 0;</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>int i; i= 0;</code>
          </td>
          <td class="c3" width="15%">

            On a variable with initialization
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Join variable
          </td>
          <td class="c4" width="34%">
            <code>int i; i= 0;</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>int i= 0</code>
          </td>
          <td class="c3" width="15%">

            On a variable without initialization
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Assign to variable
          </td>
          <td class="c4" width="34%">
            <code>foo()</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>X x= foo();</code>
          </td>
          <td class="c3" width="15%">

            On an expression statement
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Extract to local
          </td>
          <td class="c4" width="34%">
            <code>foo(getColor());</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>Color color= getColor();<br />
            foo(color);</code>
          </td>

          <td class="c3" width="15%">
            On an expression
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Assign parameter to field
          </td>
          <td class="c4" width="34%">
            <code>public A(int color) {}</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>int fColor;<br />
            public A(int color) {<br />
            &nbsp;&nbsp;&nbsp; fColor= color;<br />

            }</code>
          </td>
          <td class="c3" width="15%">
            On a parameter
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Assign all parameters to new fields
          </td>
          <td class="c4" width="34%">
            <code>public A(int color, String name) {}</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>int fColor;<br />
            String fName;<br />
            public A(int color, String name) {<br />
            &nbsp;&nbsp;&nbsp; fColor= color;<br />
			&nbsp;&nbsp;&nbsp; fName= name;<br />
            }</code>
          </td>
          <td class="c3" width="15%">
            On a parameter
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Array initializer to Array creation
          </td>

          <td class="c4" width="34%">
            <code>int[] i=&nbsp; { 1, 2, 3 }</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">

            <code>int[] i= new int[] { 1, 2, 3 }</code>
          </td>
          <td class="c3" width="15%">
            On an array initializer
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Create 'for' loops
          </td>
          <td class="c4" width="34%">
            <code>
            void foo(Map&lt;String, Integer&gt; map) {<br />
			&nbsp;&nbsp;&nbsp;map.keySet();<br />
			}<br />
            </code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>
            void foo(Map&lt;String, Integer&gt; map) {<br />
			&nbsp;&nbsp;for (String string : map.keySet()) {<br />
			&nbsp;&nbsp;}<br />
			}<br />
            </code>
          </td>
          <td class="c3" width="15%">
            On arrays, <code>Collection</code>s and <code>List</code>s
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Convert to 'enhanced for loop' (J2SE 5.0)
          </td>

          <td class="c4" width="34%">
            <code>for (Iterator i= c.iterator();i.hasNext();) {<br />
            }<br /></code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">

            <code>for (x : c) {<br />
            }</code>
          </td>
          <td class="c3" width="15%">
            On a for loop
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Convert to indexed 'for' loop (J2SE 5.0)
          </td>

          <td class="c4" width="34%">
            <code>for (x : c) {<br />
            }</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>for (int i = 0; i &lt; c.size(); i++) {<br />
            &nbsp;&nbsp;&nbsp;&nbsp;x = c[i];<br />
            }<br /></code>
          </td>
          <td class="c3" width="15%">
            On an enhanced for loop
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Convert to Iterator-based 'for' loop (J2SE 5.0)
          </td>

          <td class="c4" width="34%">
            <code>for (x : c) {<br />
            }</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>for (Iterator i= c.iterator();i.hasNext();) {<br />
            }<br /></code>
          </td>
          <td class="c3" width="15%">
            On an enhanced for loop
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Create method in super class
          </td>
          <td class="c4" width="34%">
            <br />
          </td>
          <td class="c3">
            <br />
          </td>

          <td class="c3" width="34%">
            <br />
          </td>
          <td class="c3" width="15%">
            On a method declaration
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">

            Rename in file
          </td>
          <td class="c4" width="34%">
            <br />
          </td>
          <td class="c3">
            <br />
          </td>
          <td class="c3" width="34%">

            <br />
          </td>
          <td class="c3" width="15%">
            On identifiers
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Rename in workspace
          </td>

          <td class="c4" width="34%">
            <br />
          </td>
          <td class="c3">
            <br />
          </td>
          <td class="c3" width="34%">
            <br />
          </td>

          <td class="c3" width="15%">
            On identifiers
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Extract to local variable
          </td>
          <td class="c4" width="34%">
            <code>a= b*8;</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>int x= b*8;<br />
            a= x;</code>
          </td>

          <td class="c3" width="15%">
            On expressions
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Extract to constant
          </td>
          <td class="c4" width="34%">
            <code>a= 8;</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>final static int CONST= 8;<br />
            a= CONST;</code>
          </td>

          <td class="c3" width="15%">
            On expressions
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Extract method
          </td>
          <td class="c4" width="34%">
            <code>int x= p * 5;</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>int x= getFoo(p);</code>
          </td>
          <td class="c3" width="15%">

            On expressions and statements
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Inline local variable
          </td>
          <td class="c4" width="34%">
            <code>int a= 8, b= a;</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>int b= 8;</code>
          </td>
          <td class="c3" width="15%">

            On local variables
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Convert local variable to field
          </td>
          <td class="c4" width="34%">
            <code>void foo() { int a= 8; }</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>int a= 8; void foo() {}</code>
          </td>
          <td class="c3" width="15%">

            On local variables
          </td>
        </tr>
        <tr>
          <td class="c3" width="15%">
            Convert anonymous to nested class
          </td>
          <td class="c4" width="34%">
            <code>new Runnable() { };</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>class RunnableImplementation implements Runnable { }</code>
          </td>
          <td class="c3" width="15%">

            On anonymous classes
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Convert to lambda expression
          </td>
          <td class="c4" width="34%">
            <code>Runnable r= new Runnable() {<br />
				&nbsp;&nbsp;public void run() {}<br />
				};
            </code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>Runnable r= () -&gt; {};</code>
          </td>
          <td class="c3" width="15%">
            On anonymous classes implementing a functional interface (1.8 or higher)
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Convert to anonymous class creation
          </td>
          <td class="c4" width="34%">
          	<code>Runnable r= () -&gt; {};</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>Runnable r= new Runnable() {<br />
				&nbsp;&nbsp;public void run() {}<br />
				};
            </code>
          </td>
          <td class="c3" width="15%">
            On lambda expressions (1.8 or higher)
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Convert to lambda expression
          </td>
          <td class="c4" width="34%">
          	<code>Consumer&lt;Integer&gt; c= System.out::println;</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>Consumer&lt;Integer&gt; c= t -&gt; System.out.println(t);</code>
          </td>
          <td class="c3" width="15%">
            On method references (1.8 or higher)
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Convert to method reference
          </td>
          <td class="c4" width="34%">
			<code>Consumer&lt;Integer&gt; c= t -&gt; System.out.println(t);</code>          	
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
      		<code>Consumer&lt;Integer&gt; c= System.out::println;</code>
          </td>
          <td class="c3" width="15%">
            On lambda expressions (1.8 or higher)
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Change body expression to block
          </td>
          <td class="c4" width="34%">
          	<code>Runnable r= () -&gt; System.out.println();</code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>Runnable r= () -> {<br />
				&nbsp;&nbsp;System.out.println();<br />
				};
            </code>
          </td>
          <td class="c3" width="15%">
            On lambda expressions with body as expression (1.8 or higher)
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Change body block to expression
          </td>
          <td class="c4" width="34%">
          	<code>Runnable r= () -> {<br />
				&nbsp;&nbsp;System.out.println();<br />
				};
            </code>
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
         	<code>Runnable r= () -&gt; System.out.println();</code>
          </td>
          <td class="c3" width="15%">
            On lambda expressions with body as block (1.8 or higher)
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Add inferred lambda parameter types
          </td>
          <td class="c4" width="34%">
			<code>Consumer&lt;Integer&gt; c= t -&gt; System.out.println(t);</code>          	
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
      		<code>Consumer&lt;Integer&gt; c= (Integer t) -&gt; System.out.println(t);</code>
          </td>
          <td class="c3" width="15%">
            On lambda expressions with inferred parameter types (1.8 or higher)
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Add parentheses around lambda parameter
          </td>
          <td class="c4" width="34%">
			<code>Consumer&lt;Integer&gt; c= t -&gt; System.out.println(t);</code>          	
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
      		<code>Consumer&lt;Integer&gt; c= (t) -&gt; System.out.println(t);</code>
          </td>
          <td class="c3" width="15%">
            On lambda expressions (1.8 or higher)
          </td>
        </tr>

		<tr>
          <td class="c3" width="15%">
            Remove parentheses around lambda parameter
          </td>
          <td class="c4" width="34%">
			<code>Consumer&lt;Integer&gt; c= (t) -&gt; System.out.println(t);</code>          	
          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
      		<code>Consumer&lt;Integer&gt; c= t -&gt; System.out.println(t);</code>
          </td>
          <td class="c3" width="15%">
            On lambda expressions (1.8 or higher)
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Replace with getter and setter (Encapsulate Field)
          </td>
          <td class="c4" width="34%">
            <code>p.x;</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>p.getX();</code>
          </td>
          <td class="c3" width="15%">

            On fields
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Insert inferred type arguments
          </td>
          <td class="c4" width="34%">
            <code>List&lt;String&gt; list = new ArrayList&lt;&gt;();</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>List&lt;String&gt; list = new ArrayList&lt;String&gt;();</code>
          </td>
          <td class="c3" width="15%">

            On generic instance creation expressions (1.7 or higher)
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Convert type to var
          </td>
          <td class="c4" width="34%">
            <code>String s= new String("Hello");</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>var s= new String("Hello");</code>
          </td>
          <td class="c3" width="15%">

            On variable declaration which has initializer (10 or higher)
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Convert var to inferred type
          </td>
          <td class="c4" width="34%">
            <code>var s= new String("Hello");</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>String s= new String("Hello");</code>
          </td>
          <td class="c3" width="15%">

            On variable declaration with type <b>var</b> (10 or higher)
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Add 'var' type to lambda parameters
          </td>
          <td class="c4" width="34%">
            <code>Finder finder = (s1,s2) -> s1.indexOf(s2);</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>Finder finder = (var s1,var s2) -> s1.indexOf(s2);</code>
          </td>
          <td class="c3" width="15%">

            On lambda parameters without type (10 or higher)
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Replace lambda parameter types with 'var'
          </td>
          <td class="c4" width="34%">
            <code>Finder finder = (String s1,String s2) -> s1.indexOf(s2);</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>Finder finder = (var s1,var s2) -> s1.indexOf(s2);</code>
          </td>
          <td class="c3" width="15%">

             On lambda parameters with type (10 or higher)
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Replace 'var' in lambda parameter types with inferred types
          </td>
          <td class="c4" width="34%">
            <code>Finder finder = (var s1,var s2) -> s1.indexOf(s2);</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>Finder finder = (String s1,String s2) -> s1.indexOf(s2);</code>
          </td>
          <td class="c3" width="15%">

            On lambda parameters with type <b>var</b> (10 or higher)
          </td>
        </tr>
        
        <tr>
          <td class="c3" width="15%">
            Remove lambda parameter types
          </td>
          <td class="c4" width="34%">
            <code>Finder finder = (String s1,String s2) -> s1.indexOf(s2);</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>Finder finder = (s1,s2) -> s1.indexOf(s2);</code>
          </td>
          <td class="c3" width="15%">

            On lambda parameters with type (1.8 or higher)
          </td>
        </tr>

        <tr>
          <td class="c3" width="15%">
            Split switch case labels
          </td>
          <td class="c4" width="34%">
            <code>return switch (day) {<br />
				  case MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY -> "weekday";<br />
				  case SATURDAY, SUNDAY -> "weekend";<br />
				  };</code>

          </td>
          <td class="c3">
            &gt;
          </td>
          <td class="c3" width="34%">
            <code>return switch (day) {<br />
				  case MONDAY -> "weekday";<br />
				  case TUESDAY -> "weekday";<br />
				  case WEDNESDAY -> "weekday";<br />
				  case THURSDAY -> "weekday";<br />
				  case FRIDAY -> "weekday";<br />
				  case SATURDAY, SUNDAY -> "weekend";<br />
				  };</code>
          </td>
          <td class="c3" width="15%">

            On Switch Case Labels (12 or higher)
          </td>
        </tr>
      </tbody>
    </table>

    <br />
    <p>The following quick assists are available in the <b>Properties File Editor</b>:</p>
    <ul>
       <li><b>Rename in workspace</b> - renames the key in the properties file and updates all references</li>
       <li><b>Create field in '...'</b> - creates the corresponding field in the resource bundle accessor class</li>
       <li><b>Remove property</b> - deletes the property from the properties file and the field from the resource bundle accessor class</li>
       <li><b>Remove properties</b> - deletes the selected properties from the properties file and the fields from the resource bundle accessor class</li>
       <li><b>Escape backslashes</b> - escape all backslashes in the selected text</li>
       <li><b>Escape backslashes in original string</b> - escape all backslashes in the pasted text</li>
       <li><b>Unescape backslashes</b> - unescape all backslashes in the selected text</li>
    </ul>
      
    <h3 class="related">Related concepts</h3>
      <a href="../concepts/concept-java-editor.htm">Java Editor</a><br />
      <a href="../concepts/concept-quickfix-assist.htm">Quick Fix and Quick
      Assist</a>

    <h3 class="related">Related references</h3>
      <a href="ref-java-editor-quickfix.htm">Quick Fix</a><br />
      <a href="../reference/ref-jdt-actions.htm">JDT actions</a>
  </body>
</html>
